﻿package mortal.game.view.heroArena.renderer
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.heroArena.util.*;

    public class HeroArenaInvateListCellRenderer extends GCellRenderer
    {
        private var _roleName:GTextFiled;
        private var _combat:GTextFiled;
        private var _levelCareer:GTextFiled;
        private var _invateBtn:GButton;
        private var _sArenaBasePlayer:SArenaBasePlayer;

        public function HeroArenaInvateListCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._roleName = UIFactory.gTextField("", 8 + 6, 16 - 2, 91, 20, this, GlobalStyle.textFormatBai.center());
            this._combat = UIFactory.gTextField("", 136 + 12, 16 - 2, 72, 20, this, GlobalStyle.textFormatChen);
            this._levelCareer = UIFactory.gTextField("", 231 + 7, 16 - 2, 95, 20, this, GlobalStyle.textFormatChen);
            this._invateBtn = UIFactory.gButton(Language.getString(41518), 348, 14, 43, 22, this);
            this._invateBtn.configEventListener(MouseEvent.CLICK, this.onInvateHandler);
            this.pushUIToDisposeVec(UIFactory.bg(0, 45, 403, 2, this, ImagesConst.SplitLine));
            return;
        }// end function

        private function onInvateHandler(event:MouseEvent) : void
        {
            var _loc_2:* = Cache.instance.heroArena.myTeamInfo;
            if (_loc_2 && _loc_2.teamId)
            {
                if (HeroArenaUtil.isTeamFull())
                {
                    MsgManager.showRollTipsMsg(Language.getString(41519), MsgRollTipsType.msgRollTips3);
                    return;
                }
                GameProxy.copy.inviteArenaTeam(this._sArenaBasePlayer.entityId);
                MsgManager.showRollTipsMsg(Language.getString(41520));
                this._invateBtn.filters = [FilterConst.colorFilter2];
                this._invateBtn.mouseEnabled = false;
            }
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:String = null;
            super.data = param1;
            this._sArenaBasePlayer = param1 as SArenaBasePlayer;
            if (this._sArenaBasePlayer)
            {
                this._roleName.text = this._sArenaBasePlayer.name;
                this._combat.text = this._sArenaBasePlayer.combat + "";
                _loc_2 = GameDefConfig.instance.getECareerNameAddColoer(this._sArenaBasePlayer.career);
                this._levelCareer.htmlText = "Lv." + this._sArenaBasePlayer.level + "·" + _loc_2;
                this._invateBtn.filters = [];
                this._invateBtn.mouseEnabled = true;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._roleName.dispose();
            this._roleName = null;
            this._combat.dispose();
            this._combat = null;
            this._levelCareer.dispose();
            this._levelCareer = null;
            this._invateBtn.dispose();
            this._invateBtn = null;
            this._sArenaBasePlayer = null;
            return;
        }// end function

    }
}
